package com.Java.train.member.controller;

import cn.hutool.log.Log;
import com.Java.train.member.config.MemberApplication;
import com.Java.train.member.service.PassengerService;
import com.alibaba.cloud.nacos.NacosConfigManager;
import com.alibaba.cloud.nacos.NacosConfigProperties;
import com.alibaba.cloud.nacos.endpoint.NacosConfigEndpointAutoConfiguration;
import com.alibaba.nacos.api.config.annotation.NacosConfigListener;
import com.alibaba.nacos.api.config.annotation.NacosValue;
import jakarta.validation.Valid;
import lombok.Getter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;

@RestController
@RefreshScope
public class TestController {
    private static final Logger LOG = LoggerFactory.getLogger(TestController.class);
    @Value("${test.cacos}")
    private String cacos;
    @Autowired
    private Environment environment;
    @GetMapping("/hello")
    public String cacos(){
        LOG.info("获取值为：{}", cacos);
        String port = environment.getProperty("local.server.port");
        return String.format("Hello %s!,端口号为：%s", cacos, port);
    }
}
